package com.weilive.core.session;

public final class RoleContextHolder {
	private static final ThreadLocal<SessionAccount> contextHolder = new ThreadLocal<SessionAccount>();

	public static Long getRoleId() {
		if (contextHolder.get() == null) {
			return -1L;
		}
		return contextHolder.get().getUserId();
	}

	public static SessionAccount getSessionAccount() {
		return contextHolder.get();
	}

	public static void setRole(SessionAccount sAcct) {
		contextHolder.set(sAcct);
	}

	public static void clear() {
		contextHolder.set(null);
	}
}
